package com.game_info.utils;

import com.game_info.vo.gImage;

import java.io.Serializable;

/**
 * 返回给前端的结果类
 *
 * @author ttj
 * @date 2020-4-10
 */
public class AjaxResult<T> implements Serializable {
    /**
     * 状态码
     * 默认成功:0
     */
    private Integer code = 0;
    /**
     * 信息
     */
    private String msg = "";
    /**
     * 统计
     */
    private Integer count;
    /**
     * 数据
     */
    private T data;
    /**
     * 默认成功返回值接收方法
     * @param data
     * @param msg
     * @return
     */
    public static AjaxResult put(Object data,String msg){
        return new AjaxResult(0,msg,0,data);
    }

    /**
     * 带统计参数
     * @param data
     * @param msg
     * @param count
     * @return
     */
    public static AjaxResult put(Object data,String msg,Integer count){
        return new AjaxResult(0,msg,count,data);
    }

    /**
     * 带全部参数
     * @param code
     * @param data
     * @param msg
     * @param count
     * @return
     */
    public static AjaxResult put(Integer code,Object data,String msg,Integer count){
        return new AjaxResult(code,msg,count,data);
    }

    /**
     * 构造方法
     * @param code
     * @param msg
     * @param count
     * @param data
     */
    public AjaxResult(Integer code, String msg, Integer count, T data) {
        this.code = code;
        this.msg = msg;
        this.count = count;
        this.data = data;
    }

    /**
     * getter setter
     *
     * @return
     */
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

}
